package Demo_8_28;

import Demo_07_02.timeMain;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

public class Demo06 {
    public static void main(String[] args) {
        timeMain timeMain = new timeMain();
        while (true){
            Scanner scanner = new Scanner(System.in);

            System.out.println("等待用户录入");
            String sca = scanner.next();

            switch (sca){
                case "n":
                    return;
                default:
                    DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyy年-MM月-dd日 HH时:mm分");
                    timeMain.setTime(LocalDateTime.now().format(dateTimeFormatter));
                    System.out.println(timeMain.getTime()+"按n退出");
                    break;
            }
        }
    }
}
